package com.njsoft.bodyawakening;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.njsoft.bodyawakening.table.adapter.TableAdapter;
import com.njsoft.bodyawakening.table.adapter.TableTimeAdapter;
import com.njsoft.bodyawakening.utils.TimeUtil;
import com.njsoft.bodyawakening.view.MyLayoutManger;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class MainActivity extends AppCompatActivity {

    @BindView(R.id.mRecyclerView)
    RecyclerView mRecyclerView;
    private TableAdapter tableAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);
        initRw();
    }

    private void initRw() {
        List<String> list = new ArrayList<>();
        ArrayList<String> timelist = TimeUtil.getListFormATimetoBtime(
                getString(R.string.BeginTime)
                , getString(R.string.EndTime),
                60 * 60 * 1000);
        for (int i = 0; i < timelist.size() * 7; i++) {
            list.add("item" + i);
        }
        tableAdapter = new TableAdapter(R.layout.table_item, list);
        mRecyclerView.setLayoutManager(new GridLayoutManager(this,7));
        mRecyclerView.setAdapter(tableAdapter);
    }
}
